package algorithm.swordoff;

/**
 * 替换空格
 *
 * 简单题,没什么意思,不太会考
 */

public class SQ05 {
    public String replaceSpace(String s) {
        String[] splitted = s.split("");
        StringBuilder sb = new StringBuilder("");
        for (int i = 0; i < splitted.length; i++) {
            if (" ".equals(splitted[i])) splitted[i] = "%20";
            sb.append(splitted[i]);
        }
        return sb.toString();
    }
}
